<%@page contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>候补人员管理</title>
<%@ include file="/common/header/meta.jsp"%>
<%@ include file="/common/header/script.jsp"%>

<script type="text/javascript">
	var $dg;
	$(function() {
		
		$dg = $("#dg").datagrid({
			url: $.webapp.root+"/admin/system/personinfo/doNotNeedAuth_datagrid.do",
			title: '候补人员管理', 
			idField: 'id', fit: true, border: false, pageSize: 30, pageList: [30,40,50,100,200,500,1000], rownumbers: true,
			remoteSort: true, toolbar: '#toolbars', striped:true, pagination: true, singleSelect: false,
			sortName: 'num', sortOrder: 'asc',
			frozenColumns: [[
			    { field: 'ck', checkbox: true },
			    { field: 'id', title: 'ID', width: 80, hidden: true }
			]],
			columns: [[
			    { field: 'num', title: '员工编号', width: 80, sortable: true},
			    { field: 'name', title: '员工姓名', width: 80 },
			    { field: 'sex', title: '性别', width:50, sortable: true, align: 'center'},
			    { field: 'org_name', title: '组织机构', width: 100, tooltip: true }, 
			    { field: 'position_name', title: '岗位', width: 100 },
			    { field: 'ryjb', title: '日语级别', width:60, align: 'center' },  
			    { field: 'gzjyns', title: '工作年数', width:60, sortable: true },
			    { field: 'zrbsejyns', title: '在日BSE经验月数', width:100, sortable: true },
			    
			    { field: 'status', title: '状态', align: 'center', width:80},
			    { field: 'jiaming', title: '假名', align: 'center', width:80},
			    { field: 'qzyw', title: '签证有无', align: 'center', width:80},
			    { field: 'qzyxq', title: '签证有效期', align: 'center', width:80},
			    { field: 'hzyw', title: '护照有无', align: 'center', width:80},
			    { field: 'hzyxq', title: '护照有效期', align: 'center', width:80},
			    { field: 'toCity', title: '希望出差地点', align: 'center', width:80},
			    { field: 'sxjn', title: '熟悉技能', align: 'center', width:80},
			    { field: 'lcly', title: '擅长领域', align: 'center', width:80},
			    { field: 'ccsjrq', title: '出差实际日期', align: 'center', width:80},
			    { field: 'ccydr', title: '出差预订日', align: 'center', width:80},
			    { field: 'cqcckn', title: '长期出差可能', align: 'center', width:80},
			    { field: 'javaYear', title: 'java经验年数', align: 'center', width:80},
			    { field: 'netYear', title: '.net经验年数', align: 'center', width:80},
			    { field: 'kh', title: '客户', align: 'center', width:80},
			    { field: 'aj', title: '案件', align: 'center', width:80}
			    
			]],
			onLoadSuccess: function(node, data) {
				$.fn.datagrid.extensions.onLoadSuccess.apply(this, arguments);
				$dg.datagrid('unselectAll');$dg.datagrid('clearSelections');
			}
		}) ;
	});
	
	function doSearch(value,name){
		var o = {} ; o[name] = value ; $dg.datagrid("load",o);
	}
	function searchBox() {
		var search_form = $("#searchForm").form("getData") ;
		$dg.datagrid("load",search_form);
	}
	function searchClear() {
		$("#searchForm").form("clear") ;
		$dg.datagrid("load",{});
	}
	
	function form_edit(form) {
		var form_url = $.webapp.root+"/admin/system/personinfo/personinfo_form_UI.do" ;
		if("E" == form) {
			var node = $dg.datagrid('getSelected');
			if (node) {
				form_url = $.webapp.root+"/admin/system/personinfo/personinfo_form_UI.do?id="+node.id ;
			} else {
				alertify.warning("请选择一条记录！"); return ;
			}
		}
		var $d = $.easyui.showDialog({
			href: form_url, title: "表单", iniframe: false, topMost: true, maximizable: true,
			width: 600,
			height: 500,
            enableApplyButton: false, enableCloseButton: false,  enableSaveButton: false,
            buttons : [ 
              { text : '确定', iconCls : 'ext_save', handler : function() { $.easyui.parent.submitForm($d, $dg); } },
              { text : '关闭', iconCls : 'ext_cancel', handler : function() { $d.dialog('destroy'); } } 
           	]
        });
	}
	
	function del() {
		var ids = [];
		var rows = $dg.datagrid('getChecked');
		if (rows.length > 0) {
			for ( var i = 0; i < rows.length; i++) {
				ids.push(rows[i].id);
			}
		} else {
			alertify.warning("请选择一条记录！");
			return false;
		}
		$.messager.confirm("您确定要进行该操作？", function (c) { 
			if(c) {
				$.easyui.loading({ msg: "数据删除中，请稍等..."});
				$.post($.webapp.root+"/admin/system/personinfo/doNotNeedAuth_delete.do", {"ids" : ids.join(',')}, function(result) {
					if (result.status) {
						$dg.datagrid('unselectAll');$dg.datagrid('reload') ;
						alertify.success(result.msg);
						$.easyui.loaded();
					} else {
						alertify.warning(result.msg);
						$.easyui.loaded();
					}
				}, 'json').error(function() { $.easyui.loaded(); });
			}
		});
	}
	
	
	function export_empinfo_data() {
		$("#download").attr("src", $.webapp.root+"/admin/system/personinfo/doNotNeedAuth_exportPersonInfoExcelData.do");
	}
	
</script>
</head>

<body>

	<div id="dg">
		<div id="toolbars">
            <!-- <a onClick="form_edit('A');" class="easyui-linkbutton" data-options="plain: true, iconCls: 'ext_add'">添加</a> -->
            <c:if test="${icf:hasPermit('personinfo_edit')}">
            <a onClick="form_edit('E');" class="easyui-linkbutton" data-options="plain: true, iconCls: 'ext_edit'">编辑</a>
			</c:if>
            <c:if test="${icf:hasPermit('personinfo_delete')}">
            <a onClick="del();" class="easyui-linkbutton" data-options="plain: true, iconCls: 'ext_remove'">删除</a>
			</c:if>
            <a onclick="$dg.datagrid('reload');" class="easyui-linkbutton" data-options="plain: true, iconCls: 'ext_reload'">刷新</a>
            <c:if test="${icf:hasPermit('export_data')}">
            <a onclick="export_empinfo_data();" class="easyui-linkbutton" data-options="plain: true, iconCls:'icon-hamburg-down'">导出数据</a>
			</c:if>
			
            <div id="search_bar">
            	<form id="searchForm">
	            	<div class="s_box">
	            		<div class="gr">
		            		<div class="si">
			            		<input class="easyui-searchbox" data-options="searcher:doSearch,width: 150, height: 25, menu: '#topSearchboxMenu'" />
								<div id="topSearchboxMenu" style="width: 85px;">
									<div data-options="name:'num', iconCls: 'icon-hamburg-zoom'">编号</div>
									<div data-options="name:'name', iconCls: 'icon-hamburg-zoom'">姓名</div>
									<div data-options="name:'email', iconCls: 'icon-hamburg-zoom'">邮件</div>
								</div>
		            		</div>
	            		</div>
	            		<!-- <div class="gr">
							<div class="st">日期&nbsp;</div>
							<div class="si">
								<input id="lz1" name="lz_startDate" class="Wdate" style="height:23px;" type="text" onFocus="WdatePicker({
									isShowClear:true,
									readOnly:true,
									maxDate:'#F{$dp.$D(\'lz2\')||\'2020-10-01\'}'
									})"/>
								至
								<input id="lz2" name="lz_endDate" class="Wdate" style="height:23px;" type="text" onFocus="WdatePicker({
									isShowClear:true,
									readOnly:true,
									minDate:'#F{$dp.$D(\'lz1\')}',
									maxDate:'2120-10-01'
									})"/>
							</div>
						</div> -->
						<div class="st">
		            		<a onClick="searchBox();" class="easyui-linkbutton" data-options="plain: true, iconCls: 'icon-standard-zoom'">查询</a>
		            		<a onClick="searchClear();" class="easyui-linkbutton" data-options="plain: true, iconCls: 'icon-standard-zoom-out'">重置</a>
	            		</div>
	            	</div>
            	</form>
            </div>
        </div>
	</div>
	<iframe id="download" style="display:none"></iframe> 
</body>
</html>